﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.TPYRS
{
    class Class4
    {
        public void Calc200(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Age == 18 || ppa.Age == 19 || ppa.Age == 20 || ppa.Age == 21)
            {
                da.Value = ppa.Amount * 0.8;
            }

        }

        public void Calc200(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Age == 25)
            {
                da.Value = ppa.Amount * 0.8;
            }

        }

        public void Calc200(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                da.Value = ppa.Amount;

                if (ppa.Period == 0)
                {
                    da.Value = ppa.TotalFee + ppa.Amount * 0.1;
                    da.Description = "如果第一年因为疾病身故，则支付保额的10%加已交保费：" + ppa.TotalFee + ppa.Amount * 0.1;
                }
                else
                {
                    da.Value = ppa.Amount;
                }
                ppa.IsCurrentFinish = true;
            }

        }

        public void Calc200(IPolicyPeriodActing ppa, IDutyActing da)
        {

            if (ppa.Period>0 && ( ppa.SchemePeriodActing.HolderStates.Contains("身故") || ppa.SchemePeriodActing.HolderStates.Contains("全残")))
            {
                ppa.Fee = 0;
            }

        }

        public void Calc200(IPolicyPeriodActing ppa, IDutyActing da)
        {
            
            if (ppa.IsAtPaymentPeriod && ppa.Period>0 && ( ppa.SchemePeriodActing.HolderStates.Contains("身故") || ppa.SchemePeriodActing.HolderStates.Contains("全残")))
            {
                da.Value = ppa.PolicyActing.Policy.Fee;
            }

        }

        public void Calc200(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                if (ppa.Age < 18)
                {
                    da.Value = ppa.TotalFee;
                }
                else
                {
                    double a = ppa.Amount;
                    double b = ppa.TotalFee;

                    da.Value = a > b ? a : b;
                }
                ppa.IsCurrentFinish = true;
            }

        }
    }
}
